const app = getApp()
import {
  DISABLEKEY,
  DISABLEKEYTOB
} from '../../utils/util'
Component({
  properties: {
    type: {
      type: Number,
      value: 0
    }
  },
  data: {
    IMGBASEURL: app.globalData.IMGBASEURL,
    visible: false,
    lableKey: ''
  },
  methods: {
    handlePopup(key = app.globalData.userStatus.UserInfoStatus) {
      let mykey = key ? key : '0'
      this.setData({
        lableKey: DISABLEKEY[mykey] || DISABLEKEYTOB[mykey]
      })
      this.setData({
        visible: true
      });
    },
    onVisibleChange(e) {
      if (!e.detail.visible && this.properties.type == 0) {
        app.globalData.canOpen = false
      }
      this.setData({
        visible: e.detail.visible,
      });
    },
    gopage() {
      wx.navigateTo({
        url: '/pages/ai/disable/index',
      })
    },
    gopageyong() {
      wx.navigateTo({
        url: '/pages/login/web-user/index?key=MPAgreement-UserUsed'
      })
    },
    onOk() {
      this.setData({
        visible: false
      });
    }
  },
});